<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title></title>
    <meta name = "keywords" content="<{$SiteInfo.keywords}>" >
    <meta name = "description" content="<{$SiteInfo.description}>" >
    <link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/font-awesome/css/font-awesome.css" rel="stylesheet">
    <link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style.css" rel="stylesheet">
    
    <style>

.login{width:90%;margin:0px auto;margin-bottom:50px;}

.user_login{border:1px solid black;width:80%;;margin:20px auto;padding:30px;background:#F5f5f5;border:2px solid #4d4d4d; border-radius:15px;}

user_login li{line-height:20px; width:220px;}

.loginSubmit{margin-top:20px;text-align:center;}

.userLogin{width:98%;height:30px;background:#f5f5f5;border:1px solid #ff9900;border-radius:10px;outline:0px;padding-left:10px;}

.tishi{text-align:left;display:inline-block;margin-bottom:0px;}

.userLoginyzm{width:50%;height:30px;background:#f5f5f5;border:1px solid #ff9900;margin-right:20px;border-radius:10px;outline:0px;padding-left:5px;}

.userLoginanniu{width:100px;height:30px;background:#ff9900;border:0px;font-size:16px;letter-spacing:0px;border-radius:10px;padding-left:5px;color:white;font-weight:bold;margin-top:5px;cursor:pointer;outline:0px;}

</style>
</head>

<body>

    <div id="wrapper">

        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header" style="text-align:center;">
                        <div class="dropdown profile-element"> <span>
                        <a href="__APP__">
                        <?php if($_SESSION['fix_user']){?>
                            <img alt="image" class="img-circle" src="__PUBLIC__/Uploads/<{$userPic}>" width="80px;"  height="80px;" />
                        <?php }else{ ?>
                            <img alt="image" class="img-circle" src="__PUBLIC__/Uploads/default.png" width="80px;"  height="80px;" />
                        <?php }?>    
                        </a>
                        </span>
                        <span class="clear"> <span class="block m-t-xs" style = "color:#fff;"> <strong class="font-bold"><?php echo empty($_SESSION['fix_user'])?'您的身份为<font color="green">游客</font>':$_SESSION['fix_user']['nickname']?></strong>
                        </span> 
                    </div>
                    <div class="logo-element">
                        <{$SiteInfo.name}>
                    </div>
                </li>

                <foreach name = "path1" item = "vo">
                <if condition = "$vo.display eq '1'">
                <li class="">
                    <a href="#"><i class="fa fa-bar-chart-o"></i> <span class="nav-label"><{$vo.name}></span><span class="fa arrow"></span></a>
                    <ul style="height: 0px;" aria-expanded="false" class="nav nav-second-level collapse">
                        <foreach name = "path2" item = "vs">
                        <if condition = "$vo.id eq $vs['fid']">
                        <li><a href="__MODULE__/Fenlei/index/id/<{$vs.id}>"><{$vs.name}></a></li>
                        </if>
                        </foreach>
                    </ul>
                </li>
                </if>
                </foreach>
                <li>
                    <a href="__MODULE__/Message"><i class="fa fa-globe"></i> <span class="nav-label">留言板</span></a>
                </li>
                <li>
                    <a href="__MODULE__/Userlist"><i class="fa fa-globe"></i> <span class="nav-label">本站会员</span></a>
                </li>
                <!-- <li>
                    <a href="__MODULE__/Index/yaoqingma"><i class="fa fa-globe"></i> <span class="nav-label" style = "color:#ED5565;">邀请码与源代码</span></a>
                </li> -->
                
                    </ul>
                
                </div>
            </nav>
            <div id="page-wrapper" class="gray-bg">
                <div class="row border-bottom">
                    <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                        <div class="navbar-header">
                            <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                            <form role="search" class="navbar-form-custom" action="__MODULE__/Index/serch" method="get">
                                <div class="form-group">
                                    <input type="text" placeholder="你玩儿命的搜索一下先啊" class="form-control" name="keywords" id="top-search" required>
                                </div>
                            </form>
                        </div>
                        <!-- 天气插件-->
                        <iframe allowtransparency="true" frameborder="0" width="385" height="96" scrolling="no" src="http://tianqi.2345.com/plugin/widget/index.htm?s=1&z=1&t=0&v=0&d=3&bd=0&k=&f=&q=1&e=1&a=1&c=58362&w=385&h=96&align=center"></iframe>

                        <ul class="nav navbar-top-links navbar-right">
                            <li>
                                
                                <span class="m-r-sm text-muted welcome-message">欢迎来到PRO博客！</span>
                            </li>
                       <!-- <if condition = "$Think.session.username neq ''">-->
                    <?php if(empty($_SESSION['fix_user']['username'])){?>
                       <li>
                                <a data-toggle="modal" href="#myModal6">注册</a>
                            </li>
                            <li>
                                <a data-toggle="modal" href="#modal-form">登陆</a>
                            </li>
                        
                    <?php }else{ ?>
                            <li class="dropdown">
                                <a class="dropdown-toggle count-info" data-toggle="dropdown" href="javascript:void(0)">
                                    <i class="fa fa-envelope"></i>  <span class="label label-warning">会员中心</span>
                                </a>
                                <ul class="dropdown-menu dropdown-messages">
                                    <li>
                                        <div class="dropdown-messages-box">
                                            <div class="media-body">
                                                <strong><a href="__MODULE__/User/index">进入会员中心</a></strong>. <br>
                                            </div>
                                        </div>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <div class="dropdown-messages-box">
                                            <div class="media-body ">
                                                <strong><a href="__MODULE__/User/logout">退出登陆</a></strong>. <br>
                                            </div>
                                        </div>
                                    </li>
                                    <li class="divider"></li>
                                    <li>
                                        <div class="text-center link-block">
                                                <i class="fa fa-envelope"></i> <strong>修改您的节操</strong>
                                        </div>
                                    </li>
                                </ul>
                            </li>
                        <li>欢迎你，<{$Think.session.fix_user.nickname}></li>
                    <?php }?>
                        </ul>
                        <ul class="nav navbar-top-links navbar-right">
                            <span class="m-r-sm text-muted welcome-message"><a href="__APP__"><img src="__PUBLIC__/uploads/PROlogo.jpg" style="width:110px;height:90px;margin-top:5px;margin-right:5px;"></span></a>
                        </ul>
                    </nav>
                </div>
                <!-- 登陆在这里开始 -->
                <div style="display: none;" class="modal inmodal fade in" id="modal-form" tabindex="-1" role="dialog" aria-hidden="false">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                                <h4 class="modal-title">登陆中心</h4>
                            </div>
                            <div class="modal-body">

                                <form class="form-horizontal" action="__MODULE__/User/login" method="post">
                                    <p>没有账号可不要乱登陆哦</p>
                                    <div class="form-group"><label class="col-lg-2 control-label">用户名</label>

                                        <div class="col-lg-10"><input placeholder="请输入用户名" class="form-control" type="text"  name = "username" required>
                                        </div>
                                    </div>
                                    <div class="form-group"><label class="col-lg-2 control-label">密码</label>

                                        <div class="col-lg-10"><input placeholder="请输入密码" class="form-control" type="password" name = "password" required></div>
                                    </div>
                                        <div class="form-group"><label class="tishi col-lg-2 control-label">验证码</label><span class="seema" style="color:red;font-size:14px;"></span>
                                        <div class="col-lg-5"><input id="emailcheckCodema" placeholder="不区分大小写" class="form-control reg_in" type="text" name = "codema" maxlength="4"></div>
                                        <div class="col-lg-5">
                                            <a class="yz fl" style=" margin-top:6px;" href="javascript:void(0)">
                                                <img id="imgCodema" onclick="changenCheckCodema()" style="cursor: pointer;" width="90" height="40" src="<{:U('User/yanzhengma')}>">
                                            </a>
                                            <a class="change fl" onclick="changenCheckCodema()" href="javascript:void(0)">换一换</a>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-lg-offset-5 col-lg-7">
                                            <button class="btn btn-sm btn-white" type="submit">点击登陆</button>
                                        </div>
                                    </div>
                                </form>

                            </div>
                        </div>
                    </div>
                </div>
                <!-- 登陆结束 -->



               <!-- 注册开始 -->
                <div style="display:none;" class="modal inmodal fade in" id="myModal6" tabindex="-1" role="dialog" aria-hidden="false">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                                <h4 class="modal-title">注册中心</h4>
                            </div>
                            <div class="modal-body">

                                <form class="form-horizontal" method="post" action="<{:U('User/doreg')}>" onsubmit="return checkRegster()">
                                    <div class="form-group"><label class="tishi col-lg-2 control-label">用户名</label><span class="uName" style="color:red;font-size:14px;"></span>

                                        <div class="col-lg-10"><input placeholder="请输入用户名" class="form-control reg_in" type="text" name = "username" id="uName">
                                        </div>
                                    </div>
                                    <div class="form-group"><label class="col-lg-2 control-label">昵称</label>

                                        <div class="col-lg-10"><input placeholder="请输入昵称" class="form-control" type="text" name = "nickname">
                                        </div>
                                    </div>
                                    <div class="form-group"><label class="tishi col-lg-2 control-label">邮箱</label><span class="email" style="color:red;font-size:14px;"></span>

                                        <div class="col-lg-10"><input placeholder="请输入邮箱" class="form-control reg_in" type="text" name = "email" id="email">
                                        </div>
                                    </div>
                                    <div class="form-group"><label class="tishi col-lg-2 control-label">手机号</label><span class="phone" style="color:red;font-size:14px;"></span>

                                        <div class="col-lg-10"><input placeholder="请输手机号码" class="form-control reg_in" type="text" name = "phone" id="phone">
                                        </div>
                                    </div>
                                    <div class="form-group"><label class="tishi col-lg-2 control-label">密码</label><span class="uPwd" style="color:red;font-size:14px;"></span>

                                        <div class="col-lg-10"><input placeholder="请输入密码" class="form-control reg_in" type="password" name = "password" id="uPwd"></div>
                                    </div>
                                    <div class="form-group"><label class="tishi col-lg-2 control-label">确认密码</label><span class="uPwd1" style="color:red;font-size:14px;"></span>

                                        <div class="col-lg-10"><input placeholder="请输入确认密码" class="form-control reg_in" type="password" name = "password1" id="uPwd1"></div>
                                    </div>
                                     <div class="form-group"><label class="tishi col-lg-2 control-label">验证码</label><span class="see" style="color:red;font-size:14px;"></span>
                                        <div class="col-lg-5"><input id="emailcheckCode" placeholder="不区分大小写" class="form-control reg_in" type="text" name = "code" maxlength="4"></div>
                                        <div class="col-lg-5">
                                            <a class="yz fl" style=" margin-top:6px;" href="javascript:void(0)">
                                                <img id="imgCode" onclick="changenCheckCode()" style="cursor: pointer;" width="90" height="40" src="<{:U('User/yanzheng')}>">
                                            </a>
                                            <a class="change fl" onclick="changenCheckCode()" href="javascript:void(0)">换一换</a>
                                        </div>
                                    </div> 
                                    <div class="form-group">
                                        <div class="col-lg-offset-5 col-lg-7">
                                            <input class="btn btn-sm btn-white" id="indexLogin" type="submit" onclick="this.blur();" value="立即注册">
                                        </div>
                                    </div>
                                </form>

                            </div>
                        </div>
                    </div>
                </div>
                <!-- 注册结束 -->

<script src="__PUBLIC__/js/jquery.js"></script>

<script>
// 获取焦点
// 第一种方式
$('.reg_in').focus(function(){
    $(this).addClass('tishi').removeClass('blur');
})
// 取得输入的内容
$('.reg_in')[0].onkeyup = function(en){
    str = $('#uName')[0].value;
    if(en.keyCode == 32) {
        this.value=this.value.replace(/^ +| +$/g,''); 
        return;
    }
}
/*$('.reg_in')[0].onkeyup = function(en){
    str = $('#phone')[0].value;
    if(en.keyCode == 32) {
        this.value=this.value.replace(/^ +| +$/g,''); 
        return;
    }
}
$('.reg_in')[0].onkeyup = function(en){
    str = $('#email')[0].value;
    if(en.keyCode == 32) {
        this.value=this.value.replace(/^ +| +$/g,''); 
        return;
    }
}
$('.reg_in')[0].onkeyup = function(en){
    str = $('#uPwd')[0].value;
    if(en.keyCode == 32) {
        this.value=this.value.replace(/^ +| +$/g,''); 
        return;
    }
}
$('.reg_in')[0].onkeyup = function(en){
    str = $('#uPwd1')[0].value;
    if(en.keyCode == 32) {
        this.value=this.value.replace(/^ +| +$/g,''); 
        return;
    }
}*/
// 验证用户名
/*
$('#uName').focus(function(){
    $('.uName').hide();
})
*/

$('#uName').blur(function(){
    checkUsername();
})
function checkUsername(){
    var user = $('#uName').val();
    if (user.length == '') {
        $('.uName').html('请输入用户名！');
        $('.uName').css('color','red');
    }else if (user.length < 4 || user.length > 25) {
        $('.uName').html('用户名长度应为4~25个字符！');
        $('.uName').css('color','red');
    } else {
        checkUserUnique();
        return true;
    }
    return false;
}
 //ajax验证用户名
function checkUserUnique(){
    var user = $('#uName').val();
    $.ajax({
        url:"<{:U('User/checkuName')}>",
        type:'post',
        async:true,
        data:'user='+user,
        dataType:'json',
        success:function(data){
            if (data != null) {
                $('.uName').html('该用户名已注册');
                $('.uName').css('color','red');
                return false;
            } else {
                $('.uName').html('恭喜，此用户名可以使用。');
                $('.uName').css('color','green');
                return true;
            }
        }
    })
}

// 验证密码
$('#uPwd').blur(function(){
    checkPass();
})
function checkPass(){
    var pass = $('#uPwd').val();
    var reg=/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{6,10}$/;
    if (pass.length == '') {
        $('.uPwd').html('请输入密码！');
        $('.uPwd').css('color','red');
    } else if (!reg.test(pass)) {
        $('.uPwd').html('密码格式为6到10位数字与大小写字母组合！');
        $('.uPwd').css('color','red');
    } else {
        $('.uPwd').html('密码正确');
        $('.uPwd').css({'color':'green','fontSize':'14px'});
        return true;
    }
    return false;
}

// 确认密码
$('#uPwd1').blur(function(){
    checkRpass();
})
function checkRpass(){
    var pass = $('#uPwd').val();
    var agian = $('#uPwd1').val();
    if (agian.length == '') {
        $('.uPwd1').html('请输入确认密码！');
        $('.uPwd1').css('color','red');
    } else if (agian != pass) {
        $('.uPwd1').html('两次密码不一致！');
        $('.uPwd1').css('color','red');
    } else {
        $('.uPwd1').html('密码正确');
        $('.uPwd1').css({'color':'green','fontSize':'14px'});
        return true;
    }
}
//验证邮箱
$('#email').blur(function(){
    checkEmail();
})
function checkEmail(){
    var email = $('#email').val();
    var reg=/^[a-z0-9](\w|\.|-)*@\w{2,}\.(com|cn|net|com.cn|net.cn)$/i;
    if (email.length == '') {
        $('.email').html('请输入邮箱！');
        $('.email').css({'color':'red','fontSize':'14px'});
    }else if (!reg.test(email)) {
        $('.email').html('邮箱格式不正确！');
        $('.email').css({'color':'red','fontSize':'14px'});
    } else {
        checkEmailUnique();
        return true;
    }
    return false;
}
//ajax验证用户名
function checkEmailUnique(){
    var email = $('#email').val();
    $.ajax({
        url:"<{:U('User/checkEmail')}>",
        type:'post',
        async:true,
        data:'email='+email,
        dataType:'json',
        success:function(data){
            if (data != null) {
                $('.email').html('该用户名已注册');
                $('.email').css('color','red');
                return false;
            } else {
                $('.email').html('恭喜，此用户名可以使用。');
                $('.email').css('color','green');
                return true;
            }
        }
    })
}
//验证邮箱
$('#email').blur(function(){
    checkEmail();
})
function checkEmail(){
    var email = $('#email').val();
    var reg=/^[a-z0-9](\w|\.|-)*@\w{2,}\.(com|cn|net|com.cn|net.cn)$/i;
    if (email.length == '') {
        $('.email').html('请输入邮箱！');
        $('.email').css({'color':'red','fontSize':'14px'});
    }else if (!reg.test(email)) {
        $('.email').html('邮箱格式不正确！');
        $('.email').css({'color':'red','fontSize':'14px'});
    } else {
        checkEmailUnique();
        return true;
    }
    return false;
}
// ajax验证用户名
function checkEmailUnique(){
    var email = $('#email').val();
    $.ajax({
        url:"<{:U('User/checkEmail')}>",
        type:'post',
        async:true,
        data:'email='+email,
        dataType:'json',
        success:function(data){
            if (data != null) {
                $('.email').html('该邮箱已注册');
                $('.email').css('color','red');
                return false;
            } else {
                $('.email').html('恭喜，此邮箱可以使用。');
                $('.email').css('color','green');
                return true;
            }
        }
    })
}
//验证手机
$('#phone').blur(function(){
    checkPhone();
})
function checkPhone(){
    var phone = $('#phone').val();
    var reg=/^1[3458]\d{9}$/;
    if (phone.length == '') {
        $('.phone').html('请输入手机号！');
        $('.phone').css({'color':'red','fontSize':'14px'});
    }else if (!reg.test(phone)) {
        $('.phone').html('手机号码格式不正确！');
        $('.phone').css({'color':'red','fontSize':'14px'});
    } else {
        checkPhoneUnique();
        return true;
    }
    return false;
}
// ajax验证用户名
function checkPhoneUnique(){
    var phone = $('#phone').val();
    $.ajax({
        url:"<{:U('User/checkPhone')}>",
        type:'post',
        async:true,
        data:'phone='+phone,
        dataType:'json',
        success:function(data){
            if (data != null) {
                $('.phone').html('该手机号已注册');
                $('.phone').css('color','red');
                return false;
            } else {
                $('.phone').html('恭喜，此手机号可以使用。');
                $('.phone').css('color','green');
                return true;
            }
        }
    })
}


// 验证码
                    
                    $('#emailcheckCode').blur(function(){
                        checkRegCode();
                    })
                    var reg_code = null;
                    function checkRegCode(){
                        var code = $('#emailcheckCode').val();
                        $.ajax({
                            url:"<{:U('User/code')}>",
                            type:'post',
                            async:true,
                            data:'code='+code,
                            dataType:'json',
                            success:function(data){
                                //alert(data)
                                if (data == false) {
                                    $('.see').html('验证码不正确！');
                                    $('.see').css('color','red');
                                    $('#imgCode').attr("src","<{:U('User/yanzheng')}>"+"?a="+new Date().getTime());
                                    reg_code = false;
                                } else {
                                    $('.see').html('验证码正确');
                                    $('.see').css('color','green');
                                    assignregCode();
                                    reg_code = true;
                                }
                            }
                        })
                        return reg_code;
                    }
                    
                    function assignregCode(){
                    var rcode = $('#emailcheckCode').val();
                        $.ajax({
                            url:"<{:U('rcode')}>",
                            type:'post',
                            asycn:false,
                            data:'rcode='+rcode,
                            dataType:'json',
                            success:function(data){
                                
                            }
                        })
                    }

 // 刷新验证码
    function changenCheckCode(){
        $('#imgCode').attr("src","<{:U('User/yanzheng')}>"+"?a="+new Date().getTime());
    }

// 验证码ma
                    
                    $('#emailcheckCodema').blur(function(){
                        checkRegCodema();
                    })
                    var reg_codema = null;
                    function checkRegCodema(){
                        var codema = $('#emailcheckCodema').val();
                        $.ajax({
                            url:"<{:U('User/codema')}>",
                            type:'post',
                            async:true,
                            data:'codema='+codema,
                            dataType:'json',
                            success:function(data){
                                //alert(data)
                                if (data == false) {
                                    $('.seema').html('验证码不正确！');
                                    $('.seema').css('color','red');
                                    $('#imgCodema').attr("src","<{:U('User/yanzhengma')}>"+"?a="+new Date().getTime());
                                    reg_codema = false;
                                } else {
                                    $('.seema').html('验证码正确');
                                    $('.seema').css('color','green');
                                    assignregCodema();
                                    reg_codema = true;
                                }
                            }
                        })
                        return reg_codema;
                    }
                    
                    function assignregCodema(){
                    var rcodema = $('#emailcheckCodema').val();
                        $.ajax({
                            url:"<{:U('rcodema')}>",
                            type:'post',
                            asycn:false,
                            data:'rcodema='+rcodema,
                            dataType:'json',
                            success:function(data){
                                
                            }
                        })
                    }
 // 刷新验证码
    function changenCheckCodema(){
        $('#imgCodema').attr("src","<{:U('User/yanzhengma')}>"+"?a="+new Date().getTime());
    }

$('#userLogin').click(function(){
    checkRegster();
})

function checkRegster(){
if ((checkUsername() && checkEmail() && checkPhone() && checkPass() && checkRpass() && checkRegCode()) == true) {
    return true;
} else {
    checkUsername();checkEmail();checkPhone();checkPass();checkRpass();checkRegCode();
    return false;
    }
}


</script>